import request from '@/router/axios'

export function fetchDictList(query) {
  return request({
    url: '/admin/dict/list',
    method: 'get',
    params: query
  })
}

export function fetchItemList(query) {
  return request({
    url: '/admin/dict/item',
    method: 'get',
    params: query
  })
}

export function addItemObj(obj) {
  return request({
    url: '/admin/dict/itemPut',
    method: 'post',
    data: obj
  })
}

export function getItemObj(query) {
  return request({
    url: '/admin/dict/find',
    method: 'get',
    params: query
  })
}

export function delItemObj(id) {
  return request({
    url: '/admin/dict/itemDeltet',
    method: 'get',
    params: {id: id}
  })
}

export function putItemObj(obj) {
  return request({
    url: '/admin/dict/itemPut',
    method: 'post',
    data: obj
  })
}

export function addObj(obj) {
  return request({
    url: '/admin/dict/put',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/admin/dict/single',
    method: 'get',
    params: {id:id}
  })
}

export function delObj(row) {
  return request({
    url: '/admin/dict/delete',
    method: 'delete',
    params: {id:row.id}
  })
}

export function putObj(obj) {
  return request({
    url: '/admin/dict/put',
    method: 'put',
    data: obj
  })
}

export function remote(type) {
  return request({
    url: '/admin/dict/type/' + type,
    method: 'get'
  })
}
